#include "StdAfx.h"
#include "CircuitNoERC.h"

CCircuitNoERC::CCircuitNoERC(void)
{
	m_dblPosX = 0;
	m_dblPosY = 0;
	m_dblColor[0] = 0;
	m_dblColor[1] = 0;
	m_dblColor[2] = 0;
	m_bSelected = false;
}

CCircuitNoERC::CCircuitNoERC(const CCircuitNoERC *pEntityObj)
	: CCircuitUnit(pEntityObj)
{
	m_dblPosX = pEntityObj->GetPosX();
	m_dblPosY = pEntityObj->GetPosY();
	m_dblColor[0] = pEntityObj->GetColorR();
	m_dblColor[1] = pEntityObj->GetColorG();
	m_dblColor[2] = pEntityObj->GetColorB();
	m_bSelected = pEntityObj->GetSelect();
}

CCircuitNoERC::CCircuitNoERC(CICircuit *pParentEnt)
	: CCircuitUnit(pParentEnt)
{
	m_dblPosX = 0;
	m_dblPosY = 0;
	m_dblColor[0] = 0;
	m_dblColor[1] = 0;
	m_dblColor[2] = 0;
	m_bSelected = false;
}

CCircuitNoERC::~CCircuitNoERC(void)
{
	Clear();
}

void CCircuitNoERC::Serialize(CArchive & ar)
{
	if (ar.IsStoring())
	{
		ar << m_dblPosX;
		ar << m_dblPosY;
		ar << m_dblColor[0];
		ar << m_dblColor[1];
		ar << m_dblColor[2];
		ar << m_bSelected;
	}
	else
	{
		ar >> m_dblPosX;
		ar >> m_dblPosY;
		ar >> m_dblColor[0];
		ar >> m_dblColor[1];
		ar >> m_dblColor[2];
		ar >> m_bSelected;
	}

	CCircuitUnit::Serialize(ar);
}

CObj *CCircuitNoERC::Clone() const
{
	return new CCircuitNoERC(this);
}

void CCircuitNoERC::Transform(const CMatrix transf)
{

}

bool CCircuitNoERC::GetBox(double & dblLeft, double & dblBottom, double & dblRight, double & dblTop) const
{
	return false;
}

void CCircuitNoERC::Clear()
{

}

void CCircuitNoERC::CopyDisplayObj(long lSourceLayerId, long lDestLayerId)
{
	CEntityObj::CopyDisplayObj(lSourceLayerId, lDestLayerId);
}

void CCircuitNoERC::DeleteDisplayObj(long lLayerId)
{
	CEntityObj::DeleteDisplayObj(lLayerId);
}

CDisplayObj *CCircuitNoERC::CreateDisplayObj(long lLayerId)
{
	CCircuitNoERCDisObj *pNoERCDis = new CCircuitNoERCDisObj(this);
	pNoERCDis->SetLayerId(lLayerId);
	return pNoERCDis;
}

void CCircuitNoERC::CalcBox()
{
	m_minX = m_dblPosX-5;
	m_minY = m_dblPosY-5;
	m_maxX = m_dblPosX+5;
	m_maxY = m_dblPosY+5;
}

eCircuitUnitEntType CCircuitNoERC::GetUnitType() const
{
	return CIRCUIT_NOERC;
}

double CCircuitNoERC::GetPosX() const
{
	return m_dblPosX;
}

double CCircuitNoERC::GetPosY() const
{
	return m_dblPosY;
}

double CCircuitNoERC::GetColorR() const
{
	return m_dblColor[0];
}

double CCircuitNoERC::GetColorG() const
{
	return m_dblColor[1];
}

double CCircuitNoERC::GetColorB() const
{
	return m_dblColor[2];
}

bool CCircuitNoERC::GetSelect() const
{
	return  m_bSelected;
}

void CCircuitNoERC::SetPosX( double dblPosX)
{
	m_dblPosX = dblPosX;
}

void CCircuitNoERC::SetPosY( double dblPosY)
{
	m_dblPosY = dblPosY;
}

void CCircuitNoERC::SetColorR( double colR)
{
	m_dblColor[0] = colR;
}

void CCircuitNoERC::SetColorG( double colG)
{
	m_dblColor[1] = colG;
}

void CCircuitNoERC::SetColorB( double colB)
{
	m_dblColor[2] = colB;
}

void CCircuitNoERC::SetSelect( bool bSelected)
{
	m_bSelected = bSelected;
}

